<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.1">
        <Header>
            <Title>自定义WPF扩展，需要扩展函数配合</Title>
            <Shortcut>propdpExtend</Shortcut>
            <Description>自定义WPF扩展，需要扩展函数配合</Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>type</ID>
                    <ToolTip>Property Type</ToolTip>
                    <Default>int</Default>
                </Literal>
                <Literal>
                    <ID>property</ID>
                    <ToolTip>Property Name</ToolTip>
                    <Default>MyProperty</Default>
                </Literal>
                <Literal>
                    <ID>defaultvalue</ID>
                    <ToolTip>The default value for this property.</ToolTip>
                    <Default>0</Default>
                </Literal>
                <Literal Editable="false">
                    <ID>ClassName</ID>
                    <Function>ClassName()</Function>
                    <Default>default:</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp">
                <![CDATA[#region DependencyProperty:$property$ 
public $type$ $property$
{
    get => ($type$)GetValue($property$Property);
    set => SetValue($property$Property, value);
}

public static readonly DependencyProperty $property$Property = "$property$"  
    .RegisterProperty<$type$, $ClassName$>(callBack: Set$property$);
	
private static void Set$property$(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    if (e.NewValue == e.OldValue) return;
    d.SetViewModelValue<$ClassName$ViewModel>(vm => vm.$property$ = ($type$)e.NewValue);
}
#endregion $end$]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>